/**
 * @Title: idesk_data_service.js
 * @Description: 结算首页service
 * Copyright: Copyright (c) 2014 
 * Company:中国平安
 *
 * @Project HIMS-FWA
 * @author QIANDUO875
 * @date 2014年9月24日 上午11:02:31
 * @version V1.0
 */
;
(function(){
	'use strict';
	
	var app = angular.module('fwa.services');
	app.service('IDeskDataService',['$http','BaseURL', function($http, baseUrl){
		
		var debug = false,
		debugUrls = {
				getFeeInfos:baseUrl + 'mock/infra/idesk/getFeeInfos.json',
				getOrgFeeDataGroup:baseUrl + 'mock/infra/idesk/getOrgFeeDataGroup.json', 
				queryHospital1:baseUrl + 'mock/achievements/settlement/queryHosiptal1.json',
				queryHospital2:baseUrl + 'mock/achievements/settlement/queryHosiptal2.json',
				queryHospital3:baseUrl + 'mock/achievements/settlement/queryHosiptal3.json',
				queryHospitalClass:baseUrl + 'mock/achievements/settlement/queryHosiptalClass.json',
				queryKpi2:baseUrl + 'mock/achievements/settlement/queryKpi2.json'
			},
			urls = {
				getFeeInfos:baseUrl + 'analyse/getFeeInfos.do',
				getOrgFeeDataGroup:baseUrl + 'analyse/getOrgFeeDataGroup.do',
				getOrgFeeDataGroupAnalyse:baseUrl + 'analyse/analyse.do',
				queryHospital:baseUrl + 'analyse/queryMedicalOrgAll.do',
				queryKpi:baseUrl + 'analyse/queryKpiBaseAll.do'
			},
			serv = this;
		
		function getUrl(name) {
			if(debug) {
				return debugUrls[name];
			} else {
				return urls[name];
			}
		}
		serv.result = {state:"0"};
		
		serv.getFeeInfos = function( month) {
			return $http({
				url:getUrl('getFeeInfos'),
				method:'GET',
				params:{
					month:month,
					tmp:Math.random()
				}
			});
		}
		
		//获取table数据
		serv.getFeeTableData = function(year, month) {
			return $http({
				url:getUrl('getFeeTableData'),
				method:'GET',
				params:{
					year:year,
					month:month,
					tmp:Math.random()
				}
			});
		}
		
		//获取医院费用数据，按等级
		serv.getOrgFeeDataGroup = function(month) {//
			return $http({
				url:getUrl('getOrgFeeDataGroupAnalyse'),//getUrl('getOrgFeeDataGroup'),//
				method:'GET',
				params:{
					indicatorsLabel:"fee",
					visitType:'0',
					month:month,
					tmp:Math.random()
				}
			});
		}
		
		//获取医院，按等级
		serv.queryHospital = function(params){
			return $http({
		    	 method: "get",
		    	 url: baseUrl+'community/getMedicalOrgInfoList.do',
		    	 params:params
			});
		}
		
		//指标名称
		serv.queryKpi = function(kpiType){
			return $http({
				url:getUrl('queryKpi'),
				method:'GET',
				params:{
					kpiType:kpiType,
					tmp:Math.random()
				}
			});
		}
		
		/*serv.queryKpi1 = function(){
			return $http({
				url:getUrl('queryKpi1'),
				method:'GET',
				params:{
					tmp:Math.random()
				}
			});
		}
		serv.queryKpi2 = function(){
			return $http({
				url:getUrl('queryKpi2'),
				method:'GET',
				params:{
					tmp:Math.random()
				}
			});
		}*/
		
	}]);
	
})();